<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Welcome extends MY_Controller {
    function __construct() {
        parent::__construct();
        $this->load->model('welcome_model');
        session_start();
    }

    public function index() {
        $this->load->view('login');
        if (isset($_POST['submit'])) {
            $data['email'] = $_POST['username'];
            $data['password'] = md5($_POST['password']);
            $login = $this->welcome_model->validateLogin($data);
            if(isset($login)){
                $_SESSION['userData'] = $login[0];
                redirect(base_url().'mypost');
            }else{
                echo 'Invalid';
            }
        }

        //
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */